﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;

namespace YasharEl.Infrastructure.TaskEngine.Assignments
{
    [Serializable]
    public class ParticipantType : Enumeration
    {
        #region TypeSafe Static Enumarations

        /// <summary>
        /// Single Approver — used for a single user to act on a task.
        /// This is simple case where a participant maps to a user, group, role or organizational unit.
        /// </summary>
        public static readonly ParticipantType SingleApproval = new SingleApprovalParticipantType();

        /// <summary>
        /// Group Vote — used when multiple users, working in parallel, must take action simultaneously, 
        /// such as in a hiring situation when multiple users vote to hire or reject an applicant. 
        /// You specify the voting percentage that is needed for the outcome to take effect, 
        /// such as a majority vote or a unanimous vote.
        /// This participant indicates that a set of people must work in parallel.
        /// This pattern common used for voting.
        /// </summary>
        public static readonly ParticipantType GroupVote = new GroupVoteParticipantType();

        /// <summary>
        /// Serial - this participant indicates that a set of users must work in sequence.
        /// While working in sequence can be specified in the routing policy by using multiple participants in sequence,
        /// this pattern used when the set of people is dynamic.
        /// The most common scenario for this is management chain escalation, 
        /// which is done by specifying that the list is based on a management chain within specification of this pattern.
        /// </summary>
        public static readonly ParticipantType Serial = new SerialParticipantType();

        /// <summary>
        /// FYI - For Your Information - This participant also maps to a single user, group, role, or organizational unit just as in single approver.
        /// However, this pattern indicates that the participant just receive a notification task 
        /// and the bussiness process does not wait for the participant's response.
        /// FYI participants cannot directly impact the outcome of a task, but in some cases can provide comments or add attachments.
        /// </summary>
        public static readonly ParticipantType ForYourInformation = new ForYourInformationParticipantType();

        #endregion

        #region Constructors

        protected ParticipantType(int value, string shortName, string longName)
            : base(value, shortName, longName)
        {
        }

        protected ParticipantType()
        {
        }

        #endregion

        #region Inner Classes - Type safe concrete enumarations.

        [Serializable]
        private class SingleApprovalParticipantType : ParticipantType
        {
            public SingleApprovalParticipantType()
                : base(1, "Single Approval", "Single Approver — used for a single user to act on a task.")
            {

            }
        }

        [Serializable]
        private class GroupVoteParticipantType : ParticipantType
        {
            public GroupVoteParticipantType()
                : base(2, "Group Vote", "Group Vote — used when multiple users, working in parallel, must take action simultaneously.")
            {

            }
        }

        [Serializable]
        private class SerialParticipantType : ParticipantType
        {
            public SerialParticipantType()
                : base(3, "Serial", "Serial - this participant indicates that a set of users must work in sequence.")
            {

            }
        }

        [Serializable]
        private class ForYourInformationParticipantType : ParticipantType
        {
            public ForYourInformationParticipantType()
                : base(4, "FYI - For Your Information", "FYI - For Your Information - This participant also maps to a single user, group, role, or organizational unit just as in single approver.However, this pattern indicates that the participant just receive a notification task and the bussiness process does not wait for the participant's response.")
            {

            }
        }

        #endregion
    }
}
